﻿<!DOCTYPE HTML>
<html>
{include file="public:header_css"}
<body>
<nav class="breadcrumb">
	<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 商家管理 <span class="c-gray en">&gt;</span> 商家列表
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            <a class="btn btn-primary radius" href="{:url('add')}">
				<i class="Hui-iconfont">&#xe600;</i> 添加商家
			</a>
		</span>
        <span class="r">共有数据：<strong>{$total}</strong> 条</span>
	</div>

    <div class="mt-20">
		<table class="table table-border table-bordered table-bg table-sort">
			<thead>
				<tr class="text-c">
					<th width="260">名称</th>
					<th width="60">公众号图标</th>
					<th width="290">开发配置</th>
					<th>微信服务器配置</th>
					<th width="50">接入状态</th>
                    <th width="50">分店上限</th>
                    <th width="50">已开店</th>
                    <th width="140">有效期</th>
					<th width="180">操作</th>
				</tr>
			</thead>
			<tbody id="shopList">
				{foreach name="list" item="val" key="key"}
					<tr class="text-c">
						<td class="text-l">
							&nbsp;&nbsp;商户名称：<span style="color: #0f9ae0;">【{$val['shop_no']}】</span>{$val['shop_name']}<br />
							&nbsp;&nbsp;公众号名称：{$val['wx_name']}
						</td>
						<td><img src="{$val['wx_logo']}" style="width:40px;max-height:40px;"></td>
						<td class="text-l">
							appId：{$val['appid']}<br />
							secret：{$val['appsecret']}
						</td>
						<td class="text-l">
							URL：{$val['url']}<br />
							Token：{$val['token']}
						</td>
						<td>
							{if $val['is_join'] == 1}
								<a class="btn btn-success-outline radius size-MINI">已接入</a>
							{else}
								<a class="btn btn-warning-outline radius size-MINI">未接入</a>
							{/if}
						</td>
                        <td>{$val['can_open_store']} 个</td>
                        <td>{$val['al_open_store']} 个</td>
						<td>
							{if $val['validity_time']>0}
								{$val['validity_time']|date="Y-m-d H:m:s",###}
							{elseif $val['validity_time'] == 0}
								无效
                            {elseif $val['validity_time'] == -1}
                                已过期
							{/if}
						</td>
						<td class="f-14 product-brand-manage">
							<a class="btn btn-success radius" href="{:url('edit', array('shop_id'=>$val.shop_id))}">编辑</a>
							{if $val.status == -1}
								<a class="btn btn-success radius" onclick="change('{$val.shop_id}',1,'开启店铺')">点击开启</a>
							{elseif $val.status == 0}
								<a class="btn btn-primary radius" onclick="change('{$val.shop_id}',1,'通过审核')">点击通过</a>
							{elseif $val.status == 1}
								<a class="btn btn-danger radius" onclick="change('{$val.shop_id}',-1,'关闭店铺')">点击关闭</a>
							{/if}
						</td>
					</tr>
				{/foreach}
			</tbody>
		</table>
	</div>

	{$page}

</div>

{include file="public:footer_js"}

<script type="text/javascript" src="__STATIC__/admin/lib/layer/2.4/layer.js"></script>

<script type="text/javascript">


	function change(shop_id , status , note)
	{
        layer.confirm('确认要'+note+'吗？',function(index){
            $.post(
                "{:url('deal')}",
				{
				    shop_id:shop_id,
				    status:status,
					note:note
				},
				function (res) {
					if(res.code == 1){
                        // 弹出信息
                        layer.msg(note+' OK !',{icon:6,time:1000});

                        // 页面刷新
                        setTimeout(
                            // 跳转至管理后台首页
                            function(){
                                location.replace(location.href);
                            },
                            3000
                        );

					}else{
                        // 弹出信息
                        layer.msg(res.msg,{icon:5,time:1000});
					}
                }
			);
        });
	}

	//
	$(function () {

	});

</script>
</body>
</html>